home *** CD-ROM | disk | FTP | other *** search
- The attached listing is a step debugger inspired by the "step.lsp"
- stepper included with XLISP 2.1, originally written by Jonathan Engdahl
- (jengdahl on BIX). This version has the ability to set/reset
- breakpoints, and a few bells and whistles.
-
- To invoke the stepper:
- (step (form with args))
-
- The stepper will stop and print every form, then wait for user input.
- Forms are printed compressed, i.e. only atoms at the top 2 paren. level
- are printed. The user may change the compression factor. Example:
- Suppose you have the following defined:
-
- (defun fib (n)
- (if ((or (eql n 1) (eql n 2))
- 1
- (+ (fib (- n 2)) (fib (- n 1))))))
-
- Then (step (fib 4)) will produce the following:
-
- 0 >==> (fib 4)
- 1 >==> (if (**) 1 (+ ** **)) :
-
- The colon is the stepper's prompt. For a list of commands, type h<cr>.
- All stepper commands are terminated by a return, <cr>. Typing h<cr>
- produces:
-
- Stepper Commands
- ----------------
- n - next form
- s - step over form
- f FUNCTION - go until FUNCTION is called
- b FUNCTION - set breakpoint at FUNCTION
- b <list> - set breakpoint at each function in list
- c FUNCTION - clear breakpoint at FUNCTION
- c <list> - clear breakpoint at each function in list
- c *all* - clear all breakpoints
- g - go until a breakpoint is reached
- w - where am I? -- backtrace
- q - quit stepper, continue execution
- t - toggle trace on/off
- p - pretty-print current form (uncompressed)
- e - print environment
- x <expr> - execute expression in current environment
- * nn - set list compression to nn
- h - print this summary
- All commands are terminated by <cr>
- 1 >==> (if (**) 1 (+ ** **)) :
-
- Breakpoints may be set with the b command. You may set breakpoints at
- on function, e.g. b FOO<cr> sets a breakpoint at the function FOO,
- or at various functions at once, e.g. b (FOO FIE FUM)<cr> sets
- breakpoints at the functions FOO, FIE, and FUM. Breakpoints are cleared
- with the c command in an analogous way. Furthermore, a special form of
- the c command, c *all* <cr>, clears all previously set breakpoints.
- Breakpoints are remembered from one invocation of step to the next, so
- it is only neccessary to set them once in a debugging session.
-
- The g command causes execution to proceed until a breakpoint is reached,
- at which time more stepper commands can be entered.
-
- The f command sets a temporary breakpoint at one function, and causes
- execution to proceed until that function is called.
-
- The w command prints a back trace.
-
- The q command quits and causes execution to continue uninterrupted.
-
- Entry and exit to functions are traced after a g, f, or q command. To
- turn off tracing, use the t command which toggles the trace on/off.
- Also, with trace off, the values of function parameters are not printed.
-
- The s command causes the current form to be evaluated.
-
- The n command steps into the current form.
-
- The * command changes the compression of displayed forms. E.g. in the
- previous example:
-
- 1 >==> (if (**) 1 (+ ** **)) : * 3 ; change compression to 3 ...
- 1 >==> (if (or (eql n 1) (eql n 2)) 1 (+ (fib **) (fib **))) :
-
- To have the entire form printed, set the compression to 300 or some
- outrageously high value, or just use the p command, which pretty-prints
- the form uncompressed. The d command simply displays the compressed
- form again.
-
- The e command causes the current environment to be printed; the x
- command causes an expression to be executed in the current environment.
- Note that this permits the user to alter values while the program is
- running, and may affect execution of the program.
-
- I hope this is of some value to you all. Feel free to make any
- changes/enhancements. Regards,
- Ray.
-
- Ray Comas, comas@math.lsa.umich.edu
- ------------------------------------
- Remember, Finite Groups are your FRIENDS!!
- ------------------------------------
-
-
-